<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white" @change="onChange">
      <van-swipe-item v-for="(item,index) in list" :key="index">
        <img :src="item.src" alt width="100%" :title="item.title" />
      </van-swipe-item>
      <template #indicator>
        <div class="custom-indicator">{{ current + 1 }}/4</div>
      </template>
    </van-swipe>
  </div>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      value: [],
    },
  },
  data() {
    return {
      current: 0,
    };
  },
  methods: {
    onChange(index) {
      this.current = index;
    },
  },
};
</script>

<style>
.my-swipe img {
  display: block;
}

.custom-indicator {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 5px;
  font-size: 28px;
  color: #fff;
  background: rgba(0, 0, 0, 0.1);
}
</style>